package demo1;

class Base {
    public int a = 99;
    public int b;

    public void methodB(){
        System.out.println("methodB");
    }
}
class Derived extends Base {
    public int c;
    public String a = "100";//当子类和父类的名字相同时，此时使用的是当前子类的成员变量
    public void methodD() {
        System.out.println(super.a);
        System.out.println(b);
        System.out.println(c);
        System.out.println("methodD");
    }
    public void methodB(char ch){
        System.out.println("methodB - char ch");
    }
    public void test() {
        methodB();
        methodB('c');
        //此时这两个方法构成了重载
    }
}
public class TestDemo2 {
    public static void main(String[] args) {
        Derived derived = new Derived();
        derived.test();
    }
}
